package com.lsq.lwf.common.aspect;

import java.lang.reflect.InvocationHandler;
import java.lang.reflect.Method;
import java.lang.reflect.Proxy;

import org.apache.log4j.Logger;

public class LightHandler implements InvocationHandler {

	private Object proxyObj;
	private static Logger log=Logger.getLogger(LightHandler.class);

	public Object bind(Object obj) {
		this.proxyObj = obj;

		return Proxy.newProxyInstance(
				this.proxyObj.getClass().getClassLoader(), this.proxyObj
						.getClass().getInterfaces(), this);
	}

	public Object invoke(Object proxy, Method method, Object[] args)
			throws Throwable {
		
		log.info("["+proxy.getClass().getName()+"]调用["+method.getName()+"]");
		
		Object result=null;
		
		result=method.invoke(proxy, args);
		
		return result;
	}

	public Object getProxyObj() {
		return proxyObj;
	}

	public void setProxyObj(Object proxyObj) {
		this.proxyObj = proxyObj;
	}

}
